﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo3_1_4
{
    internal class Program
    {
        public static Person person = new Person();
        static void Main(string[] args)
        {
            Task.Run(() => {
                lock (person)
                {
                    Console.WriteLine($"tid={Environment.CurrentManagedThreadId}");
                    Console.ReadLine();
                }
            });

            Task.Run(() => {
                lock (person)
                {
                    Console.WriteLine($"tid2={Environment.CurrentManagedThreadId}");
                    Console.ReadLine();
                }
            });
            Console.ReadLine();
        }
        public class Person
        {
            public string Name { get; set; }
            public int Age { get; set; }
        }
    }
}
